package com.ruoyi.project.system.domain.vo;

import com.alibaba.fastjson2.JSONObject;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;

import java.util.Date;

@Data
public class AuthelecDto {

    private String orderNo;

    private String code;

    private String msg;

    private String liveRate;

    private String similarity;

    private String occurredTime;

    private String photo;

    private String video;

    private String trtcFlag;

    private String appId;

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date createTime;

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date updateTime;

    public AuthelecDto() {
    }

    public AuthelecDto(String orderNo,String msg) {
        this.msg = msg;
        this.orderNo = orderNo;
    }

    public AuthelecDto(FaceBackResultVo fbrv) {
        this.orderNo = fbrv.getOrderNo();
        this.code = fbrv.getCode();
    }

    public AuthelecDto(JSONObject faceAuth) {
        JSONObject result = faceAuth.getJSONObject("result");
        this.code = faceAuth.getString("code");
        this.msg = faceAuth.getString("msg");
        this.orderNo = result.getString("orderNo");
        this.liveRate = result.getString("liveRate");
        this.similarity = result.getString("similarity");
        this.occurredTime = result.getString("occurredTime");
        this.photo = result.getString("photo");
        this.video = result.getString("video");
        this.trtcFlag = result.getString("trtcFlag");
        this.appId = result.getString("appId");
    }
}
